package com.campus.counseling.controller;

import com.campus.counseling.entity.CounselorPrice;
import com.campus.counseling.service.CounselorPriceService;
import com.campus.counseling.model.common.Result;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.RequiredArgsConstructor;
import org.springframework.web.bind.annotation.*;

@Api(tags = "咨询师价格管理")
@RestController
@RequestMapping("api/counselor/price")
@RequiredArgsConstructor
public class CounselorPriceController {

    private final CounselorPriceService counselorPriceService;

    @ApiOperation("设置咨询价格")
    @PostMapping("/set")
    public Result<Void> setPrice(@RequestBody CounselorPrice price) {
        counselorPriceService.setPrice(price);
        return Result.success();
    }

    @ApiOperation("获取咨询师价格")
    @GetMapping("/{counselorId}")
    public Result<CounselorPrice> getPrice(@PathVariable Long counselorId) {
        return Result.success(counselorPriceService.getPriceByCounselorId(counselorId));
    }

    @ApiOperation("更新咨询价格")
    @PutMapping("/update")
    public Result<Void> updatePrice(@RequestBody CounselorPrice price) {
        counselorPriceService.updatePrice(price);
        return Result.success();
    }

    @ApiOperation("启用/禁用价格设置")
    @PutMapping("/status")
    public Result<Void> updateStatus(@RequestParam Long id, @RequestParam String status) {
        counselorPriceService.updateStatus(id, status);
        return Result.success();
    }
} 